<template>
  <div>
    <div>
      <a href="https://blog.csdn.net/duanjunkaisky/article/details/124480485?spm=1001.2101.3001.6650.8&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-8-124480485-blog-116716996.235%5Ev38%5Epc_relevant_anti_t3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-8-124480485-blog-116716996.235%5Ev38%5Epc_relevant_anti_t3&utm_relevant_index=9">
        address
      </a>
    </div>


    <div>  </div>

    <div>
      <conditionGroup :floor="floor" :conditionList="conditionList" :parentData="this" :key-list="keyOptions" :condition-map="conditionOptions" :val-list="valueOptions"> </conditionGroup>

      <el-button type="primary" @click="query">查询</el-button>
    </div>
  </div>

</template>

<script>
import conditionGroup from "./conditionGroup";

const condition = {
  id: 1,
  index: 1,
  condition: '',
  operate: 'and',
  field: '',
  value: '',
  header: true,
  checked: false,
  pid: -1,
  floor: 1
}

export default {
  name: 'demo',
  components: {
    conditionGroup
  },
  data() {
    return {
      conditionList: [
        Object.assign({}, condition)
      ],
      floor: 1,

      keyOptions: [
        {'key': 'ID', 'val': 'id'},
        {'key': '名称', 'val': 'name'},
        {'key': '类型', 'val': 'type'},
        {'key': '来源', 'val': 'source'},
        {'key': '昵称', 'val': 'nick_name'},
        {'key': '创建时间', 'val': 'create_time'},
        {'key': '更新时间', 'val': 'update_time'},
      ],
      conditionOptions: {
        type: [
          {'key': '=', 'val': 'eq'},
        ],
        source: [
          {'key': '=', 'val': 'eq'},
        ]
      },
      valueOptions: {
        type : {
          dom: 'select',
          data: [
            {'key': 'time', 'val': 'time'},
            {'key': 'date', 'val': 'date'},
          ]
        },
        source : {
          dom: 'select',
          data: [
            {'key': 'm1', 'val': 'm'},
            {'key': 'a1', 'val': 'a'},
          ]
        },
        create_time : {
          dom: 'date'
        },
        update_time : {
          dom: 'date'
        },
      }
    }
  },
  created() {

  },
  methods: {
    query(){
      console.log(this.conditionList)
    }
  }
}
</script>

<style scoped>

</style>
